<?php
require('config.php');

        $user_id=$_REQUEST['user_id'];
        //$user_id=9;
		$sql="select *,".$oto."_orders.createTime as xiadan_time from `".$oto."_orders`,`".$oto."_order_goods`,`".$oto."_shops` where ".$oto."_orders.userId='".$user_id."' and `orderFlag`='1' and ".$oto."_orders.orderId=".$oto."_order_goods.orderId and ".$oto."_shops.shopId=".$oto."_orders.shopId and ".$oto."_orders.orderType!='4' order by ".$oto."_orders.createTime DESC";
		$result=$db->query($sql);
		while($row=$result->fetch_assoc()){
			$orders[]=$row;//将取得的所有数据赋值给person_info数组
		}
		if(isset($orders))
		{
			for($i=0;$i<count($orders);$i++)
			{
				$orderId=$orders[$i]['orderId'];
				$sql="SELECT * FROM ".$oto."_goods_appraises where orderId='{$orderId}'";
				$result=$db->query($sql);
				while($row=$result->fetch_assoc()){
					$pingjia[$i][]=$row;//将取得的所有数据赋值给person_info数组
				}
				if(isset($pingjia[$i]))
				{
					$orders[$i]['isPingjia']=1;
				}
				else $orders[$i]['isPingjia']=0;
			}
			echo json_encode($orders);
		}
		else
		{
			echo '[]';
		}
		
?>